// require("babel-polyfill");
import Vue from "vue";
import ElementUI from "element-ui";
import 'nprogress/nprogress.css'
import App from "./App.vue";
import router from "./router.js";
import store from "./store/store.js";
import axios from "axios";
import CONFIG from "@/constants/config";
import NProgress from "nprogress";
import Imutation from "@/components/assembly/Imutation";

axios.defaults.baseURL = CONFIG.getBaseURL();
// 当路由进入前
router.beforeEach((to, from, next) => {
  // 每次切换页面时，调用进度条
  NProgress.start();
  // 这个一定要加，没有next()页面不会跳转的。这部分还不清楚的去翻一下官网就明白了
  next();
});
// 当路由进入后：关闭进度条
router.afterEach(() => {
  setTimeout(() => {
    NProgress.done();
  }, 500);
});
NProgress.configure({
  easing: "ease-in", // 动画方式
  speed: 800, // 递增进度条的速度
  showSpinner: false, // 是否显示加载ico
  trickleSpeed: 200, // 自动递增间隔
  minimum: 0.3 // 初始化时的最小百分比
});

Vue.use(ElementUI);


Vue.component("i-mutation", Imutation);



// 全局引用jquery

new Vue({
  router,
  template: "<App/>",
  render: h => h(App),
  store,

  beforeMount() {
    // 初始化全局弹框,loader
    // window.showLoader();
  },

  mounted() {
    this.init();
  },

  methods: {
    /**
     * 初始化
     */
    init() {
      // document.getElementById("mask").className = "hide";
    },

    initModals() {}
  }
}).$mount("#app");
